package team.seekers.hula.question.answerComment.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import team.seekers.hula.common.annotation.ApiResponseBody;
import team.seekers.hula.common.entity.PageResult;
import team.seekers.hula.question.answerComment.entity.vo.AnswerCommentManageListVO;
import team.seekers.hula.question.answerComment.entity.dto.AnswerCommentManageUpdateDTO;
import team.seekers.hula.question.answerComment.entity.dto.AnswerCommentQueryDTO;
import team.seekers.hula.question.answerComment.service.AnswerCommentManageService;
import team.seekers.hula.question.answerComment.service.AnswerCommentService;

/**
 * @author hmh
 * @description
 */
@Controller
@ApiResponseBody
@RequestMapping("/manage/answerComment")
public class AnswerCommentManageController {

    @Autowired
    private AnswerCommentService answerCommentService;

    @Autowired
    private AnswerCommentManageService answerCommentManageService;


//    @GetMapping("/delete")
//    public void adminDelete(@RequestParam("answerId") String id){
//        answerCommentService.adminDelete(id);
//    }


//    @PostMapping("/pageOrderByTime")
//    public PageResult<AnswerManageListVO> pageAdminAnswerCondition(@RequestBody(required = false) AnswerQueryDTO answerQuery){
//        return answerService.adminPageOrderByTime(answerQuery.getPageNow(), answerQuery.getPageSize(), answerQuery);
//    }


    @PostMapping("/update")
    public void update(@RequestBody AnswerCommentManageUpdateDTO updateVO){
        System.out.println("调用接口");
        answerCommentManageService.update(updateVO);
    }

    @GetMapping("/approveExamine")
    public void approveExamine(@RequestParam String id){
        answerCommentManageService.changeApproval(id,1);
    }
    @GetMapping("/failedExamine")
    public void failedExamine(@RequestParam String id){
        answerCommentManageService.changeApproval(id,2);
    }

    @GetMapping("/page")
    public PageResult<AnswerCommentManageListVO> page(AnswerCommentQueryDTO answerCommentQuery){
        return answerCommentManageService.listInManage(answerCommentQuery);
    }

}
